using System;
using System.Linq;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Collections.Generic;
using Acme.Sales.EFDAL.Entity;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("Acme.Sales.EFDAL.Entity", "FK__Territory_Region", "Region", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(Acme.Sales.EFDAL.Entity.Region), "TerritoryList", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(Acme.Sales.EFDAL.Entity.Territory), true)]
[assembly: EdmRelationshipAttribute("Acme.Sales.EFDAL.Entity", "EmployeeTerritory", "EmployeeList", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(Acme.Sales.EFDAL.Entity.Employee), "TerritoryList", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(Acme.Sales.EFDAL.Entity.Territory))]

#endregion

namespace Acme.Sales.EFDAL
{
	#region TableMappingConstants Enumeration

	/// <summary>
	/// A map for all entity types in this library
	/// </summary>
	public enum TableMappingConstants
	{
		/// <summary>
		/// A mapping for the the Customer entity
		/// </summary>
		Customer,
		/// <summary>
		/// A mapping for the the Employee entity
		/// </summary>
		Employee,
		/// <summary>
		/// A mapping for the the EmployeeType entity
		/// </summary>
		EmployeeType,
		/// <summary>
		/// A mapping for the the Region entity
		/// </summary>
		Region,
		/// <summary>
		/// A mapping for the the SystemUser entity
		/// </summary>
		SystemUser,
		/// <summary>
		/// A mapping for the the Territory entity
		/// </summary>
		Territory,
	}

	#endregion

	#region StaticDataConstants Enumeration for 'EmployeeType' entity
	/// <summary>
	/// Enumeration to define static data items and their ids 'EmployeeType' table.
	/// </summary>
	public enum EmployeeTypeConstants
	{
		/// <summary>
		/// Enumeration for the 'Normal' item
		/// </summary>
		[Description("")]
		Normal = 1,
		/// <summary>
		/// Enumeration for the 'BigFish' item
		/// </summary>
		[Description("")]
		BigFish = 2,
	}
	#endregion

	#region Entity Context

	/// <summary>
	/// There are no comments for SalesEntities in the schema.
	/// </summary>
	public partial class SalesEntities : System.Data.Objects.ObjectContext
	{
		/// <summary>
		/// The audit modifier used to mark database edits
		/// </summary>
		protected ContextStartup _contextStartup = new ContextStartup(null);

		/// <summary>
		/// Initializes a new SalesEntities object using the connection string found in the 'SalesEntities' section of the application configuration file.
		/// </summary>
		public SalesEntities() :
			base("name=SalesEntities", "SalesEntities")
		{
			this.OnContextCreated();
		}

		/// <summary>
		/// Initialize a new SalesEntities object with an audit modifier.
		/// </summary>
		public SalesEntities(ContextStartup contextStartup) :
			base("name=SalesEntities", "SalesEntities")
		{
			_contextStartup = contextStartup;
			this.OnContextCreated();
		}

		/// <summary>
		/// Initialize a new SalesEntities object.
		/// </summary>
		public SalesEntities(string connectionString) :
			base(connectionString, "SalesEntities")
		{
			this.OnContextCreated();
		}

		/// <summary>
		/// Initialize a new SalesEntities object.
		/// </summary>
		public SalesEntities(System.Data.EntityClient.EntityConnection connection) :
			base(connection, "SalesEntities")
		{
			this.OnContextCreated();
		}

		partial void OnContextCreated();

		/// <summary>
		/// There are no comments for Customer in the schema.
		/// </summary>
		public virtual System.Data.Objects.ObjectQuery<Customer> Customer
		{
			get { return this.SystemUser.OfType<Customer>(); }
		}

		/// <summary>
		/// There are no comments for Employee in the schema.
		/// </summary>
		public virtual System.Data.Objects.ObjectQuery<Employee> Employee
		{
			get { return this.SystemUser.OfType<Employee>(); }
		}

		/// <summary>
		/// There are no comments for Region in the schema.
		/// </summary>
		public virtual System.Data.Objects.ObjectSet<Acme.Sales.EFDAL.Entity.Region> Region
		{
			get
			{
				if ((this._region == null))
				{
					this._region = base.CreateObjectSet<Acme.Sales.EFDAL.Entity.Region>("Region");
				}
				return this._region;
			}
		}

		/// <summary>
		/// The internal reference variable for the 'Region' object set
		/// </summary>
		protected System.Data.Objects.ObjectSet<Acme.Sales.EFDAL.Entity.Region> _region;

		/// <summary>
		/// There are no comments for SystemUser in the schema.
		/// </summary>
		public virtual System.Data.Objects.ObjectSet<Acme.Sales.EFDAL.Entity.SystemUser> SystemUser
		{
			get
			{
				if ((this._systemuser == null))
				{
					this._systemuser = base.CreateObjectSet<Acme.Sales.EFDAL.Entity.SystemUser>("SystemUser");
				}
				return this._systemuser;
			}
		}

		/// <summary>
		/// The internal reference variable for the 'SystemUser' object set
		/// </summary>
		protected System.Data.Objects.ObjectSet<Acme.Sales.EFDAL.Entity.SystemUser> _systemuser;

		/// <summary>
		/// There are no comments for Territory in the schema.
		/// </summary>
		public virtual System.Data.Objects.ObjectSet<Acme.Sales.EFDAL.Entity.Territory> Territory
		{
			get
			{
				if ((this._territory == null))
				{
					this._territory = base.CreateObjectSet<Acme.Sales.EFDAL.Entity.Territory>("Territory");
				}
				return this._territory;
			}
		}

		/// <summary>
		/// The internal reference variable for the 'Territory' object set
		/// </summary>
		protected System.Data.Objects.ObjectSet<Acme.Sales.EFDAL.Entity.Territory> _territory;

		#region AddItem Methods

		/// <summary>
		/// Adds an object of type 'Customer' to the object context.
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Acme.Sales.EFDAL.Entity.Customer entity)
		{
			entity.CreatedBy = _contextStartup.Modifer;
			entity.ModifiedBy = _contextStartup.Modifer;
			base.AddObject("SystemUser", entity);
		}

		/// <summary>
		/// Adds an object of type 'Employee' to the object context.
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Acme.Sales.EFDAL.Entity.Employee entity)
		{
			entity.CreatedBy = _contextStartup.Modifer;
			entity.ModifiedBy = _contextStartup.Modifer;
			base.AddObject("SystemUser", entity);
		}

		/// <summary>
		/// Adds an object of type 'Region' to the object context.
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Acme.Sales.EFDAL.Entity.Region entity)
		{
			entity.CreatedBy = _contextStartup.Modifer;
			entity.ModifiedBy = _contextStartup.Modifer;
			base.AddObject("Region", entity);
		}

		/// <summary>
		/// Adds an object of type 'SystemUser' to the object context.
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Acme.Sales.EFDAL.Entity.SystemUser entity)
		{
			entity.CreatedBy = _contextStartup.Modifer;
			entity.ModifiedBy = _contextStartup.Modifer;
			base.AddObject("SystemUser", entity);
		}

		/// <summary>
		/// Adds an object of type 'Territory' to the object context.
		/// </summary>
		/// <param name="entity">The entity to add</param>
		public virtual void AddItem(Acme.Sales.EFDAL.Entity.Territory entity)
		{
			entity.CreatedBy = _contextStartup.Modifer;
			entity.ModifiedBy = _contextStartup.Modifer;
			base.AddObject("Territory", entity);
		}

		/// <summary>
		/// Adds an object to the object context.
		/// </summary>
		[Obsolete("This method signature is no longer used. Use the AddItem method.", true)]
		[System.ComponentModel.EditorBrowsable(EditorBrowsableState.Never)]
		public new void AddObject(string entitySetName, object entity)
		{
			throw new Exception("This method signature is no longer used. Use the AddItem method.");
		}

		#endregion

	}

	#endregion

	#region Type Tables

	/// <summary>
	/// The wrapper class for the type table 'EmployeeType' used to define properties on related entities
	/// </summary>
	[EdmComplexTypeAttribute(NamespaceName="Acme.Sales.EFDAL.Entity", Name="EmployeeTypeWrapper")]
	[DataContractAttribute(IsReference=true)]
	[Serializable()]
	public partial class EmployeeTypeWrapper : ComplexObject
	{
		private EmployeeTypeConstants _status;

		/// <summary>
		/// The numeric value associated with the type
		/// </summary>
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[DataMemberAttribute()]
		public int Value
		{
			get { return (int)_status; }
			set { _status = (EmployeeTypeConstants)value; }
		}

		/// <summary>
		/// Serves as a hash function for a particular type.
		/// </summary>
		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		/// <summary>
		/// The enum value associated with the type
		/// </summary>
		public EmployeeTypeConstants EnumValue
		{
			get { return _status; }
			set { _status = value; }
		}

		/// <summary>
		/// Convert the enum to a wrapper object
		/// </summary>
		public static implicit operator
				EmployeeTypeWrapper(EmployeeTypeConstants status)
		{
			return new EmployeeTypeWrapper { EnumValue = status };
		}

		/// <summary>
		/// Convert a wrapper object into its associated integer value
		/// </summary>
		public static implicit operator
				int(EmployeeTypeWrapper statusWrapper)
		{
			return (int)statusWrapper.EnumValue;
		}

		/// <summary>
		/// Convert a wrapper object into its associated enum value
		/// </summary>
		public static implicit operator
				EmployeeTypeConstants(EmployeeTypeWrapper statusWrapper)
		{
			return statusWrapper.EnumValue;
		}

		/// <summary>
		/// Test two wrapper objects for equality
		/// </summary>
		public static bool operator ==(EmployeeTypeWrapper a, EmployeeTypeWrapper b)
		{
			return true;
		}

		/// <summary>
		/// Test two wrapper objects for inequality
		/// </summary>
		public static bool operator !=(EmployeeTypeWrapper a, EmployeeTypeWrapper b)
		{
			return false;
		}

		/// <summary>
		/// Compare a wrapper objects for equality against the current instance
		/// </summary>
		public override bool Equals(object obj)
		{
			//return (EmployeeTypeWrapper)obj == this;
			return true;
		}

	}

	#endregion

}
